apiVersion: v1
kind: BuildConfig
metadata:
  name: "greenwave-docker-build"
  labels:
    environment: "greenwave"
spec:
  runPolicy: Serial
  source:
    dockerfile: |-
      FROM fedora:26
      LABEL \
          name="Greenwave" \
          vendor="Fedora Infrastructure" \
          license="MIT"
      RUN dnf -v -y install --setopt=tsflags=nodocs \
          python-gunicorn \
          python-requests \
          PyYAML \
          fedmsg-hub \
          python2-flask \
          python-memcached \
          nc \
          bind-utils
      RUN dnf -v -y install --setopt=tsflags=nodocs \
          https://kojipkgs.fedoraproject.org//packages/greenwave/0.3/4.fc26/noarch/greenwave-0.3-4.fc26.noarch.rpm
      # create a symlink for configuring the fedmsg consumers.
      RUN ln -sfn /etc/fedmsg-greenwave.d/greenwave.py /etc/fedmsg.d/zz_greenwave.py
      # And another two for putting the certs in place.
      RUN mkdir -p /etc/pki/fedmsg/
      RUN ln -sf /etc/pki/fedmsg/key/fedmsg-greenwave.key /etc/pki/fedmsg/greenwave.key
      RUN ln -sf /etc/pki/fedmsg/crt/fedmsg-greenwave.crt /etc/pki/fedmsg/greenwave.crt
      # Make sure fedmsg can write its CRL.
      RUN chmod 777 /var/run/fedmsg/
      ENV USER=openshift
      EXPOSE 8080
      ENTRYPOINT gunicorn --bind 0.0.0.0:8080 --access-logfile=- greenwave.wsgi:app
  strategy:
    type: Docker
  output:
    to:
      kind: ImageStreamTag
      name: greenwave:latest
